package studychinese.model;


import android.content.Context;

import com.hschinese.pronunciation.activity.MyApplication;
import com.hschinese.pronunciation.bean.TestChinesePraciticeBean;

import java.util.List;

import studychinese.utils.SPUtils;

/**
 * Created by zf on 2017/12/28.
 */

public class UserBean  {
    public static void setPerson(RegisterBean.DataBean dataBean) {

        dataBean.setLearn_time("");
        dataBean.setUser_image("");
        dataBean.setInterest("");
        dataBean.setCountry_id("");
        dataBean.setLang("");
        dataBean.setUser_age("");
        dataBean.setUser_agent("");
        dataBean.setUser_targetlevel("");
        dataBean.setUser_initlevel("");
        dataBean.setUser_curlevel("");
        dataBean.setUser_name("");
        dataBean.setUser_nickname("");
        dataBean.setUser_passwd("");
       dataBean.setUser_id("");
    }
    public static RegisterBean.DataBean getInfor(){
        RegisterBean.DataBean userBean = SPUtils.getObject(MyApplication.getInstance(), "userInfo", "userInfo", RegisterBean.DataBean.class);
        return userBean;
    }
    public static String getUId(){
        RegisterBean.DataBean userBean = SPUtils.getObject(MyApplication.getInstance(), "userInfo", "userInfo", RegisterBean.DataBean.class);
        String user_id = userBean.getUser_id();
        return user_id;
    }
    public static  void putUserBean ( RegisterBean.DataBean userBean){
       if(userBean!=null){
           SPUtils.putObject(MyApplication.getInstance(), "userInfo", "userInfo",userBean);
       }

    }
    public static TextRecultBean getTetResultInfor(){
        TextRecultBean testResultBean = SPUtils.getObject(MyApplication.getInstance(), "testResultBean", "testResultBean", TextRecultBean.class);
        return testResultBean;
    }
    public static  void putTetResultInfor (Context context, TextRecultBean testResultBean){
       if(testResultBean!=null){
           SPUtils.putObject(context, "testResultBean", "testResultBean",testResultBean);
       }

    }
    public static TestChinesePraciticeBean getChinesePraciceInfor(){
        TestChinesePraciticeBean testResultBean = SPUtils.getObject(MyApplication.getInstance(), "testChinesePraciticeBean", "testChinesePraciticeBean", TestChinesePraciticeBean.class);

        return testResultBean;
    }
    public static List<String> getListWrongChain(){

        List list = SPUtils.getList(MyApplication.getInstance(), "ListWrongChain", "ListWrongChain");
        return list;
    }
    public static  void putChinesePraciceInfor (Context context, TestChinesePraciticeBean testResultBean){
       if(testResultBean!=null){
           SPUtils.putObject(context, "testChinesePraciticeBean", "testChinesePraciticeBean",testResultBean);
       }

    }
    public static  void putListWrongChain (Context context, List<String> list){
       if(list!=null){
           SPUtils.putList(context,"ListWrongChain","ListWrongChain",list);

       }

    }

}
